Redefine units of VDI.virtual_size to be bytes, not sectors.
authorEwan Mellor <ewan@xensource.com>
Sun, 25 Feb 2007 23:45:39 +0000 (23:45 +0000)
committerEwan Mellor <ewan@xensource.com>
Sun, 25 Feb 2007 23:45:39 +0000 (23:45 +0000)
Signed-off-by: Ewan Mellor <ewan@xensource.com>
docs/xen-api/xenapi-datamodel.tex
tools/python/scripts/test_vm_create.py
tools/python/scripts/xapi.py
tools/python/scripts/xapi.vdicfg.py
tools/python/xen/xend/XendQCoWStorageRepo.py

index 97cbab514993cf27b2586cda8bf987476174f455..2978c06ff3be9d5c062ab6ec3981d27a0d65bf93 100644 (file)
@@ -9617,7 +9617,7 @@ $\mathit{RW}$ &  {\tt name/description} & string & a notes field containg human-
 $\mathit{RW}$ &  {\tt SR} & SR ref & storage repository in which the VDI resides \\
 $\mathit{RO}_\mathit{run}$ &  {\tt VBDs} & (VBD ref) Set & list of vbds that refer to this disk \\
 $\mathit{RO}_\mathit{run}$ &  {\tt crash\_dumps} & (crashdump ref) Set & list of crash dumps that refer to this disk \\
-$\mathit{RW}$ &  {\tt virtual\_size} & int & size of disk as presented to the guest (in multiples of sector\_size field) \\
+$\mathit{RW}$ &  {\tt virtual\_size} & int & size of disk as presented to the guest (in bytes). Note that, depending on storage backend type, requested size may not be respected exactly \\
 $\mathit{RO}_\mathit{run}$ &  {\tt physical\_utilisation} & int & amount of physical space that the disk image is currently taking up on the storage repository (in bytes) \\
 $\mathit{RO}_\mathit{ins}$ &  {\tt sector\_size} & int & sector size of VDI (in bytes) \\
 $\mathit{RO}_\mathit{ins}$ &  {\tt type} & vdi\_type & type of the VDI \\
index 84959c3e0d618b21fe4119ba9bc987c1d5d4a015..e4d8f3023a3b5114c1f174f797a88e450d3b9cb8 100644 (file)
@@ -39,7 +39,7 @@ vm_cfg = {
 vdi_cfg = {
     'name_label': 'API_VDI',
     'name_description': '',
-    'virtual_size': 100 * 1024,
+    'virtual_size': 100 * 1024 * 1024,
     'sector_size': 1024,
     'type': 'system',
     'parent': '',
index b5fe8b36823f4b69d0a77869e0052cf54a1fc2c2..1e49f86d4c8026788ef6f771092b382c8a5abc01 100644 (file)
@@ -569,7 +569,7 @@ def xapi_vdi_list(args, async = False):
     if not is_long:
         print VDI_LIST_FORMAT % {'name_label': 'VDI Label',
                                  'uuid' : 'UUID',
-                                 'virtual_size': 'Sectors',
+                                 'virtual_size': 'Bytes',
                                  'sector_size': 'Sector Size'}
         
         for vdi in vdis:
@@ -628,7 +628,7 @@ def xapi_vdi_create(args, async = False):
     sr = srs[0]
     cfg['SR'] = sr
 
-    size = (cfg['virtual_size'] * cfg['sector_size'])/MB
+    size = cfg['virtual_size']/MB
     print 'Creating VDI of size: %dMB ..' % size,
     uuid = execute(server, 'VDI.create', (session, cfg), async = async)
     if async:
index f694b83cf5cbf7fb340e6ba4a4ee92b962595a0d..86129bfae93e803bbe59cb8248263c1250f931ee 100644 (file)
@@ -1,6 +1,6 @@
 name_label = 'VDI 1'
 name_description = ''
-virtual_size = 10 * 1024
+virtual_size = 10 * 1024 * 1024
 sector_size = 1024
 type = 'system'
 sharable = False
index 763d76da8bc953782452d13647fd08e20524e3db..ad4fa7fb88989a6198fc0cc377777558cc848b2d 100644 (file)
@@ -326,7 +326,7 @@ class XendQCoWStorageRepo(XendStorageRepository):
             image = self.images[image_uuid]
             image_cfg = {
                 'sector_size': sector_size,
-                'virtual_size': sector_count,
+                'virtual_size': size_bytes,
                 'type': vdi_struct.get('type', 'system'),
                 'name_label': vdi_struct.get('name_label', ''),
                 'name_description': vdi_struct.get('name_description', ''),